/**
 * Created by Administrator on 2017/4/20.
 */
import rt from 'angular-ui-router';
import html from './index.html';
import './index.scss';
export default angular.module('husband.ci',[rt]).config(['$stateProvider', function ($stateProvider) {
  $stateProvider.state('husband.ci', {
    url: '/husband/ci',
    template:html
  });
}]).controller('ciController', ["$scope","$http",function ($scope,$http) {
  $http.post('/vmdb-web/ciClass/getClassTree',{}).then((data)=>{
    $scope.treeList = data.data;
  });
  $scope.show =function (x) {
    x.show = !x.show;
  };

  $scope.searchCi = function (e) {
    console.log(e);
    console.log(this);
  };

  $scope.ciDate = function (x) {
    $scope.showCi  = 'true';
    $http.post('/vmdb-web/ciClass/queryById',x.id).then((data)=>{
      console.log(data);
      $scope.datas = data.data.ciClass;
      for(var i = 0 ; i < $scope.treeList.length; i++) {
        if($scope.treeList[i].dir.id ==  $scope.datas.dirId) {
          $scope.datas.fileName = $scope.treeList[i].dir.dirName;
          break;
        };
        console.log( $scope.datas);

      }
    });
  };

  }]);